<?php

namespace humhub\modules\api\models;

use Yii;
use humhub\components\ActiveRecord;
use humhub\modules\user\models\User;

class RealName extends ActiveRecord
{

    /**
     * @return string the associated database table name
     */
    public static function tableName()
    {
        return 'user_realname';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        return array(
            //[['realname', 'idcard', 'img1', 'img2'], 'required'],
            [['realname'], 'required'],
            [['school'], 'string', 'max' => 100],
            [['major'],  'string', 'max' => 45],
            [['stime'],  'string', 'max' => 7],
            [['degree'], 'string', 'max' => 45],
        );
    }

    public function getUser()
    {
        return $this->hasOne(User::className(), ['id' => 'user_id']);
    }
}
